package nine_Chat;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class ClientReaderThreadDuanToDuan extends Thread {
    private Socket s;

    public ClientReaderThreadDuanToDuan(Socket s) {
        this.s = s;
    }

    @Override
    public void run() {
        String msg;
        BufferedReader br = null;
        try {
            br = new BufferedReader(new InputStreamReader(s.getInputStream()));
            while ((msg = br.readLine()) != null) {
                System.out.println("receive: " + msg);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
